/**
 * 
 */
package br.unifor.mia.cd.middleware.encrypt;

import arcademis.MarshalException;
import br.unifor.mia.cd.middleware.encrypt.annotation.Encryptable;
import br.unifor.mia.cd.middleware.util.MarshalableUtil;

/**
 * Stream responsible to encrypt Marshalable Objects with {@link Encryptable} Annotation
 * 
 * @author arthurlandim
 *
 */
public abstract class EncryptAbstractStream implements GenericStream {
	
	@Override
	public void write(Object m) throws MarshalException {
		if (m != null) {
			if (m.getClass().isAnnotationPresent(br.unifor.mia.cd.middleware.encrypt.marshalable.Marshalable.class)) {
				MarshalableUtil.marshal(this, m);
			}
		} 
	}
	

}
